class NewsListModel {
  final String dateString;
  final List<NewsModel> news;

  const NewsListModel({required this.dateString, required this.news});
}

class NewsModel {
  late String title;
  late String hint;
  late String imageUrl;
  late String url;

  NewsModel.fromMap(Map<String, dynamic> map) {
    if (map.containsKey('title')) {
      title = map['title'] as String;
    }
    if (map.containsKey('hint')) {
      hint = map['hint'] as String;
    }
    if (map.containsKey('url')) {
      url = map['url'] as String;
    }

    if (map.containsKey('images')) {
      var images = map['images'] as List<dynamic>;
      imageUrl = images.first;
    } else if (map.containsKey('image')) {
      imageUrl = map['image'] as String;
    }
  }
}